/*
 * 订单确认
 * */
import request from "@/utils/request";

/*****************云当铺-start****************************/

/*
 * 获取-排行榜模块订单列表
 * */
export function getRankOrderAddList() {
  return request.get('/sy/getRank/orderAdd/list')
}

/*
 * 获取申请单列表
 * */
export function getSyDepositApply(data) {
  return request.get('/sy/getDepositApply/list',data || {})
}

/*
 * 我的合同列表
 * */
export function getMyContractPageList(data) {
  return request.get('/sy/getMyContract/list',data || {})
}

/*
 * 回收单列表
 * */
export function getRecoverOrderPageList(data) {
  return request.get('/sy/getUserTester/recoverOrder/list',data || {})
}
/*
 * 获取-我的合同-详情
 * */
export function getMyContractDetails(contractNo) {
  return request.get('/sy/getMyContractDetails/' + contractNo)
}
/*
 * 获取申请单-详情
 * */
export function getSyDepositApplyDetails(id) {
  return request.get('/sy/getApplyDetails/' + id)
}

/*
 * 获取-客服-申请单列表
 * */
export function getServiceApply(data) {
  return request.get('/sy/getServiceApply/list',data || {})
}
/*
 * 获取-客服-申请单-详情
 * */
export function getServiceApplyDetails(id) {
  return request.get('/sy/getServiceApplyDetails/' + id)
}
/*
 * 获取-客服-的-邮寄汇报单-列表
 * */
export function getServiceMailReport (params) {
	return request.get('/sy/getServiceMailReport/list', params, {
	  login: true,
	});
}
/*
 * 获取-客服-的-邮寄汇报单-详情
 * */
export function getMailReportDetails(id) {
  return request.get('/sy/getMailReportDetails/' + id)
}

/*
 * 获取-检测师-的-邮寄汇报单-列表
 * */
export function getUserTesterMailReport (params) {
	return request.get('/sy/getUserTesterMailReport/list', params, {
	  login: true,
	});
}
/*
 * 获取-检测师-的-邮寄汇报单-详情
 * */
export function getUserTesterMailReportDetails(id) {
  return request.get('/sy/getUserTesterMailReportDetails/' + id)
}
/*
 * 检测师-处理邮寄汇报单操作
 * */
export function testerMailReportStatus(data) {
  return request.post('/sy/testerMailReportStatus/submit', data)
}

/*
 * BDM客服转单-处理操作
 * */
export function changeKeApplyOrder(data) {
  return request.post('/sy/changeKeApplyOrder/submitOrder', data)
}

/*
 * 云当铺-买回-寄存订单详情
 * */
export function getPayCheckRedeemOrderDetails(id) {
  return request.get('/sy/getPayCheckRedeemOrderDetails/' + id)
}

/*
 * 云当铺-检测师-买回处理-验证操作
 * */
export function getRedeemOrderDetailsOrExpress(id) {
  return request.get('/sy/getRedeemOrderDetails/handleCheck/' + id)
}

/*
 * 云当铺-检测师寄存订单-买回处理
 * */
export function checkTesterHandleSubmit(data) {
  return request.post('/sy/checkTesterHandleSubmit/order', data)
}


/*
 * 云当铺-客服提交线索处理状态
 * */
export function serviceClueStatusSubmit(data) {
  return request.post('/sy/service/clueStatus/submit', data)
}

/*
 * 云当铺-客服提交是否有效（0有效；1无效）
 * */
export function serviceEffectiveStatusSubmit(data) {
  return request.post('/sy/service/effectiveStatus/submit', data)
}

/*
 * 意向单-业务人员跟单描述记录
 * */
export function serviceFollowSubmitInfo(data) {
  return request.post('/sy/deposit/apply/follow/submit', data)
}
/*
 * 云当铺-买回-寄存订单验证
 * */
export function getPayCheckRedeemApply(data) {
  return request.post('/sy/getPayCheckRedeem/orderDetails/byRedeemOrder', data)
}
/*
 * 获取订单列表-分页
 * status : 查询状态：-1全部、100寄存中、101已逾期、102买回中、103已回收、104已买回
 * */
export function getUserTesterOrder (params) {
	return request.get('/sy/getUserTesterOrder/list', params, {
	  login: true,
	});
}

/*
 * 获取-进入延期页面-订单详情
 * */
export function getUserOrderDetails(id) {
  return request.get('/sy/getUserOrderDetails/' + id)
}

/*
 * 获取-业务人员邮寄查看处理-订单详情
 * */
export function getKefuApplyDetails(id) {
  return request.get('/sy/handleIndex/getKefuApplyDetails/' + id)
}


/*
 * 根据延期天数&买回金额-延期技术服务费&延期差价和到期时间返回数据
 * */
export function getDelayServiceFeeByDays(data) {
  return request.post('/sy/getDelayServiceFeeByDays', data)
}

/*
 * 客服提交顺丰下单或取消下单处理状态
 * */
export function serviceShunFengOrderSubmit(data) {
  return request.post('/sy/serviceShunFengOrder/submit', data)
}

/*
 * 获取-当检测师的订单详情
 * orderNo 寄存订单号
 * */
export function getUserTesterOrderDetails(orderNo) {
  return request.get('/sy/getUserTesterOrderDetails/' + orderNo)
}


/*
 * 获取当检测师线下回收处理订单详情
 * orderNo 寄存订单号
 * */
export function getOfflineOrderDetails(orderNo) {
  return request.get('/sy/getOfflineOrderOrderDetails/' + orderNo)
}

/*
 * 获取-检测师/用户的回收订单详情
 * orderNo 寄存订单号
 * */
export function getUserTesterRecoverOrderDetails(orderNo) {
  return request.get('/sy/getUserTester/recoverOrder/details/' + orderNo)
}

/*
 * 云当铺-获取当前延期列表
 * 根据寄存订单号
 * */
export function getSyOrderDelayInfoPageList (params) {
	return request.get('/sy/getSyOrderDelayInfoPageList/list', params, {
	  login: true,
	});
}

/*
 * 云当铺-寄存订单延期单详情
 * */
export function getPublicOrderDelayDetails(id) {
  return request.get('/sy/getPublicOrderDelayDetails/' + id)
}

/*
 * 云当铺-取消-未支付-延期单
 * */
export function cancelDelayOrder(data) {
	return request.post("/sy/cancelDelayOrder/del", data, {
		login: true
	});
}

/*
 * 云当铺-获取当前客服类型
 * */
export function getCurrentService(id) {
  return request.get('/sy/getCurrentService/info')
}
/*
 * 云当铺-申请单-取消
 * */
export function cancelApplyOrder(data) {
	return request.post("/sy/cancelApplyOrder/del", data, {
		login: true
	});
}

/*
 * 寄存单-检测师线下买回处理
 * */
export function offlineOrderRedeemRedeem(data) {
  return request.post('/sy/offlineOrder/redeem/redeem',data)
}

/*
 * 寄存单-检测师线下确认回收
 * */
export function offlineOrderRecovery(data) {
  return request.post('/sy/offlineOrder/confirm/recovery',data)
}

/*
 * 寄存单-检测师线下延期处理
 * */
export function offlineOrderDelayHandle(data) {
  return request.post('/sy/offlineOrder/delay/handle',data)
}

/*
 * 回收单-检测师-出售处理
 * */
export function recoverOrderSellingHandle(data) {
  return request.post('/sy/recoverOrder/selling/handle',data)
}

/*
 * 我的合同-作废检查
 * orderNo 订单号
 * */
export function getMyContractCancelCheck(orderNo) {
  return request.get('/sy/getMyContract/cancelCheck/' + orderNo)
}

/*
 * 我的合同-作废提交
 * */
export function myContractInfoCancelOrderSubmit(data) {
  return request.post('/sy/myContractInfo/cancelOrder/submit',data)
}
/*

 * 云当铺-回收单-只能删除，特殊处理的订单
 * */
export function cancelSpecialRecoveOrder(data) {
	return request.post("/sy/cancelSpecial/recoveOrder/del", data, {
		login: true
	});
}

/**
 * 延期-买回订单支付
 * @param object data
 */
export function delayOrRedeemOrderPay(data) {
	return request.post('sy/orderPay/payment', data);
}

/*
 * 云当铺列表-待支付-寄存订单延期单详情
 * */
export function getPayCheckDelayDetails(id) {
  return request.get('/sy/getPayCheckDelayDetails/' + id)
}

/*
 * 云当铺-寄存订单号查询详情
 * orderNo 寄存订单号
 * orderType :delay:延期；反之买回
 * */
export function getPublicByOrderNoDetails(data) {
  return request.get('/sy/getPublicByOrderNoDetails/' + data.orderNo +'/'+ data.orderType)
}

/*
 * 获取-买回订单物流信息
 * */
export function getOrderExpress(id) {
  return request.get('/sy/order/getExpress/' + id)
}

/*
 * 获取-商城订单物流信息
 * */
export function getShopOrderExpress(id) {
  return request.get('/sy/shop/order/express/' + id)
}

/**
 * 云当铺app1.1版本：通过购物车 id 获取订单信息
 * @param cartId
 * @returns {*}
 */
export function syShopPostOrderConfirm(cartId) {
	return request.post("/sy/shop/order/confirm", {
		cartId
	});
}

/**
 * 云当铺app1.1版本：计算订单金额
 * @param key
 * @param data
 * @returns {*}
 */
export function syShopPostOrderComputed(key, data) {
	return request.post("/sy/shop/order/computed/" + key, data);
}


/**
 * 云当铺app1.1版本：生成订单
 * @param key
 * @param data
 * @returns {*}
 */
export function syShopCreateOrder(key, data) {
	return request.post("/sy/shop/order/create/" + key, data || {});
}

/**
 * 云当铺app1.1版本：订单详情
 * @returns {*}
 */
export function syShopOrderDetail(id) {
	return request.get("/sy/shop/order/detail/" + id);
}

/**
 * 云当铺app1.1版本：订单统计数据
 * @returns {*}
 */
export function syShopGetOrderData() {
	return request.get("/sy/shop/order/data");
}

/**
 * 云当铺app1.1版本：订单列表
 * @returns {*}
 */
export function syShopGetOrderList(data) {
	return request.get("/sy/shop/order/list", data);
}

/**
 * 云当铺app1.1版本：取消订单
 * @returns {*}
 */
export function cancelOrder(id) {
	return request.post("/sy/shop/order/cancel", {
		id
	});
}

/**
 * 云当铺app1.1版本：删除订单
 * @returns {*}
 */
export function delOrder(uni) {
	return request.post("/sy/shop/order/del", {
		uni
	});
}

/**
 * 云当铺app1.1版本：退款理由
 * @returns {*}
 */
export function getRefundReason() {
	return request.get("/sy/shop/order/refund/reason");
}

/**
 * 云当铺app1.1版本：确认收货
 * @returns {*}
 */
export function takeOrder(uni) {
	return request.post("/sy/shop/order/take", {
		uni
	});
}
/*****************云当铺-end****************************/
/**
 * 通过购物车 id 获取订单信息
 * @param cartId
 * @returns {*}
 */
export function postOrderConfirm(cartId) {
	return request.post("/order/confirm", {
		cartId
	});
}

/**
 * 计算订单金额
 * @param key
 * @param data
 * @returns {*}
 */
export function postOrderComputed(key, data) {
	return request.post("/order/computed/" + key, data);
}

/**
 * 获取指定金额可用优惠券
 * @param price
 * @returns {*}
 */
export function getOrderCoupon(cartId) {
	return request.get("/coupons/order/" + cartId);
}

/**
 * 生成订单
 * @param key
 * @param data
 * @returns {*}
 */
export function createOrder(key, data) {
	return request.post("/order/create/" + key, data || {});
}

/**
 * 订单统计数据
 * @returns {*}
 */
export function getOrderData() {
	return request.get("/order/data");
}

/**
 * 订单列表
 * @returns {*}
 */
export function getOrderList(data) {
	return request.get("/order/list", data);
}

/**
 * 订单详情
 * @returns {*}
 */
export function orderDetail(id) {
	return request.get("/order/detail/" + id);
}

/**
 * 提交退款
 * @returns {*}
 */
export function postOrderRefund(data) {
	return request.post("/order/refund/verify", data);
}


/**
 * 订单查询物流信息
 * @returns {*}
 */
export function express(params) {
	return request.post("order/express", params);
}

/**
 * 订单查询物流信息
 * @returns {*}
 */
export function payOrder(uni, paytype, from) {
	return request.post("order/pay", {
		uni,
		paytype,
		from
	});
}
/**
 * 订单核销
 * @returns {*}
 */

export function orderVerific(verifyCode, isConfirm) {
	return request.post("order/order_verific", { verifyCode, isConfirm });
}
/**
 * 获取订阅消息ID
 * @param price
 * @returns {*}
 */
export function getSubscribeTemplate(msgType) {
	return request.get("/sy/shop/order/getSubscribeTemplate/" + msgType);
}
